from django.db import models
from  tinymce.models import HTMLField

# Create your models here.
class User(models.Model):
    account= models.CharField('账号',max_length=20,unique=True)
    password = models.CharField('密码',max_length=20)
    headimg= models.CharField('头像路径',max_length=100,default='/static/images/nobody.jpg')
    testcard=models.IntegerField('测试卡',default=0)
    weekcard=models.IntegerField('周卡',default=0)
    monthcard=models.IntegerField('月卡',default=0)
    foevercard=models.IntegerField('永久卡',default=0)
    versionstring=models.CharField('版本权限',max_length=100,default='AV')
    def __str__(self):
        return self.account
class OrderList(models.Model):
    account_from= models.CharField('发起人',max_length=20)
    account_to= models.CharField('接收人',max_length=20,default='创建注册码')
    Cards_type= models.CharField('卡类型',max_length=20)
    Create_Time = models.DateTimeField('创建时间',  auto_now_add=True)
    Cards_Count=models.IntegerField('数量',default=0)
    Money=models.IntegerField('金额',default=0)
    def __str__(self):
        return self.account_to
class Customer(models.Model):
    token = models.CharField('注册码', max_length=100,unique=True)
    name = models.CharField('项目', max_length=100)
    number = models.CharField('设备码',blank=True,max_length=100)
    author = models.CharField('创建者', max_length=100)
    title = models.CharField('类别', max_length=100)
    Create_time = models.DateTimeField('创建时间',  auto_now_add=True)
    Duty_time = models.DateTimeField('有效期',blank=True,null=True)
    register_time = models.DateTimeField('绑定时间',blank=True,null=True, max_length=100)
    last_run_time = models.DateTimeField('最后运行',blank=True,null=True,max_length=100)
    register_count = models.IntegerField('注册次数',default=0)
    run_count = models.IntegerField('运行次数',default=0)
    cancel_time = models.DateTimeField('解绑时间',blank=True,null=True, max_length=100)
    def __str__(self):
        return self.token
class Update(models.Model):
    version = models.CharField('版本', max_length=100)
    type = models.CharField('性质', max_length=100)
    force = models.BooleanField('强制更新',default=False)
    detial = models.CharField('更新说明', max_length=100)
    def __str__(self):
        return self.version

# python manage.py makemigrations
#python manage.py migrate